home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_400
/
436_01
/
inhelp.c
< prev
next >
Wrap
Text File
|
1994-10-07
|
4KB
|
106 lines
/*************************************************************************
INHELP.C
INCON demo program help window.
INCON source files and the object and library files created from
them are:
Copyright (c) 1993-94, Richard Zigler.
You may freely distribute unmodified source, object, and library
files, and incorporate them into your own non-commercial software,
provided that this paragraph and the program name and copyright
strings defined in INCON.C are included in all copies.
*************************************************************************/
#include <bios.h>
#include <conio.h>
#include <dos.h>
#include <stdio.h>
#include <stdlib.h>
#include "indefs.h"
#include "indecl.h"
#include "addattr.h"
#define HELP_WIN 11,3,69,23 /* help window coordinates */
static char HelpStr[] =
{
"╔══════════════╤══════════════════════╤═══════════════════╗"
"║ INCON Keys │ Template Fields │ Other Fields ║"
"╠═╤═╤══════════╪══════════════════════╪═══════════════════╣"
"║ │~C~│ Home │ First Input Slot │ Start of Field ║"
"║ │~U~│ End │ Last Input Slot │ End of Field ║"
"║ │~R~│ Left │ Previous Input Slot │ Character Left ║"
"║ │~S~│ Right │ Next Input Slot │ Character Right ║"
"║ │~O~│ ^Left │ Input Group Left │ Word Left ║"
"║ │~R~│ ^Right │ Input Group Right │ Word Right ║"
"╟─┼─┼──────────┼──────────────────────┼───────────────────╢"
"║ │ │ ^Home │ Clear Slots to First │ Clear to Start ║"
"║ │ │ ^End │ Clear Slots to Last │ Clear to End ║"
"║ │ │ ^L │ Delete Group Left │ Delete Word Left ║"
"║ │~E~│ ^R │ Delete Group Right │ Delete Word Right ║"
"║ │~D~│ Del │ Delete at Cursor │ Delete at Cursor ║"
"║ │~I~│ BS │ Delete Slot Left │ Delete Left ║"
"║ │~T~│ Esc │ Clear All Slots │ Clear Input Field ║"
"║ │ │ Num + │ Special Exit │ Special Exit ║"
"║ │ │ Num - │ Special Exit │ Special Exit ║"
"║ │ │ Enter │ Terminate Input │ Terminate Input ║"
"╚═╧═╧══════════╧══════════════════════╧═══════════════════╝"
};
#define NUM_ATTRS 20
static char AttrList[NUM_ATTRS];
/************************************************************************/
/* Display help screen. To initialize AttrList, pass a negative */
/* value in Attr (set the high bit); thereafter, pass normal attribute. */
int pascal InHelp( register int Attr )
{
int rtn = 0;
if ( Attr < 0 ) /* init help screen attributes */
{
int i;
int high_attr = Attr ^ 0x0F; /* complement fgnd for highlight */
/* if high_attr is invisible, toggle intensity bit */
if ( ((high_attr & 0x70) >> 4) == (high_attr & 0x0F) )
high_attr ^= 0x08;
for ( i = NUM_ATTRS - 1 ; i >= 0 ; i-- )
AttrList[i] = i & 1 ? Attr : high_attr ;
}
else
{
char * save_scr = NULL;
char * help_scr = NULL;
if (
(save_scr = malloc( sizeof(HelpStr) * 2 )) == NULL
||
(help_scr = malloc( sizeof(HelpStr) * 2 )) == NULL
)
--rtn;
else
{
Cursor( OFF );
gettext( HELP_WIN, save_scr );
AddAttr( help_scr, HelpStr, AttrList, NUM_ATTRS, Attr, '~' );
puttext( HELP_WIN, help_scr );
while ( !KEYREADY ) /* wait for keypress */
;
KEYREAD; /* and throw it away */
puttext( HELP_WIN, save_scr );
Cursor( ON );
}
if ( help_scr )
free( help_scr );
if ( save_scr )
free( save_scr );
}
return( rtn );
}
/**** EOF: INHELP.C ****/